/*
package com.itheima.reggie.utils;

import com.itheima.reggie.entity.Category;
import com.itheima.reggie.entity.Employee;

import javax.servlet.http.HttpSession;
import java.lang.reflect.Field;
import java.time.LocalDateTime;

public class XxxUtil {


    public static void setCommonProperty(Object target,HttpSession session) {

        try {
            Class<?> aClass = target.getClass();
            Field field = aClass.getDeclaredField("createTime");
            field.setAccessible(true);
            field.set(target,LocalDateTime.now());

            field = aClass.getDeclaredField("updateTime");
            field.setAccessible(true);
            field.set(target,LocalDateTime.now());


            Employee loginEmployee = (Employee) session.getAttribute("loginEmployee");
            Long id = loginEmployee.getId();

            field = aClass.getDeclaredField("createUser");
            field.setAccessible(true);
            field.set(target,id);

            field = aClass.getDeclaredField("updateUser");
            field.setAccessible(true);
            field.set(target,id);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("设置公共属性出错！");
        }
    }
}
*/
